//
//  WYCSetDissController.m
//  51信用卡
//
//  Created by 中企互联 on 2017/11/2.
//  Copyright © 2017年 中企互联. All rights reserved.
//

#import "WYCSetDissController.h"
#import "WYCOpinionController.h"
#import "WYCSetPassController.h"
#import "WYCHideCardController.h"
#import "WYCLoginController.h"
#import "SetGestureLockViewController.h"

@interface WYCSetDissController ()<UITableViewDelegate,UITableViewDataSource>


@property(nonatomic,strong)UITableView * tableView;

@end

@implementation WYCSetDissController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    //setNav
    [self setNav];
    
    
    //创建表视图
    [self setupTableView];
    
}

#pragma make -------->>TableView
- (void)setupTableView{
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 64, ScreenWidth, cellHeight * 6 + 50 * px) style:UITableViewStylePlain];
    //    self.tableView.backgroundColor = [UIColor redColor];
    self.tableView.dataSource = self;
    self.tableView.scrollEnabled = NO;
    self.tableView.delegate = self;
    [self.view addSubview:self.tableView];
    
    
    
    UIButton * cellbutton = [[UIButton alloc] init];
    cellbutton.frame = CGRectMake(0, CGRectGetMaxY(self.tableView.frame)+ 60 * px, ScreenWidth, cellHeight);
    cellbutton.titleLabel.font = [UIFont systemFontOfSize:WyzFont];
    [cellbutton setTitleColor:bigredColor forState:UIControlStateNormal];
    cellbutton.contentHorizontalAlignment = UIControlContentVerticalAlignmentCenter;
    [cellbutton addTarget:self action:@selector(cellButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [cellbutton setTitle:@"退出登录" forState:UIControlStateNormal];
    cellbutton.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:cellbutton];
    
}
#pragma make ------->>setNav
- (void)setNav {
    self.navigationItem.title = @"设置";
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
    [self.navigationController.navigationBar setBarTintColor:bigredColor];
    
    self.view.backgroundColor = WYCGlobalBg;
}

#pragma make ------->>退出登录点击事件
- (void)cellButtonClick{
    WYCLogFunc;
    WYCLoginController * login = [[WYCLoginController alloc] init];
    [self presentViewController:login animated:NO completion:nil];
    
    
}

#pragma make ------->>UItableView代理方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 8;
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row == 4) {
        return 30 * px;
    }else{
        return 140 * px;
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    tableView.tableFooterView = [[UIView alloc] init];
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"123"];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"123"];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    if (indexPath.row == 0 || indexPath.row == 4) {
        
    }else{
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        
    }
    
    CGFloat celltitleX = 40 * px;
    CGFloat celltitleW = 240 * px;
    
    CGFloat celltitleH = 60 * px;
    
    if (indexPath.row == 0) {
        UIView * cellView = [[UIView alloc] init];
        cellView.frame = CGRectMake(0, 0, ScreenWidth, cell.height);
        [cell addSubview:cellView];
        
        
        UILabel * pushtitle = [[UILabel alloc] init];
        pushtitle.frame = CGRectMake(celltitleX, celltitleX, celltitleW, celltitleH);
        pushtitle.text = @"提醒设置";
        pushtitle.font = [UIFont systemFontOfSize:WyzFont];
        [cellView addSubview:pushtitle];
    }else if (indexPath.row == 1){
        UIView * cellView = [[UIView alloc] init];
        cellView.frame = CGRectMake(0, 0, ScreenWidth, cell.height);
        [cell addSubview:cellView];
        
        
        UILabel * pushtitle = [[UILabel alloc] init];
        pushtitle.frame = CGRectMake(celltitleX, celltitleX, celltitleW, celltitleH);
        pushtitle.text = @"账户安全";
        pushtitle.font = [UIFont systemFontOfSize:WyzFont];
        [cellView addSubview:pushtitle];
        
    }else if (indexPath.row == 2){
        UIView * cellView = [[UIView alloc] init];
        cellView.frame = CGRectMake(0, 0, ScreenWidth, cell.height);
        [cell addSubview:cellView];
        
        
        UILabel * pushtitle = [[UILabel alloc] init];
        pushtitle.frame = CGRectMake(celltitleX, celltitleX, celltitleW, celltitleH);
        pushtitle.text = @"支付设置";
        pushtitle.font = [UIFont systemFontOfSize:WyzFont];
        [cellView addSubview:pushtitle];
        
    }else if (indexPath.row == 3){
        UIView * cellView = [[UIView alloc] init];
        cellView.frame = CGRectMake(0, 0, ScreenWidth, cell.height);
        [cell addSubview:cellView];
        
        
        UILabel * pushtitle = [[UILabel alloc] init];
        pushtitle.frame = CGRectMake(celltitleX, celltitleX, celltitleW * 2, celltitleH);
        pushtitle.text = @"管理隐藏卡片";
        pushtitle.font = [UIFont systemFontOfSize:WyzFont];
        [cellView addSubview:pushtitle];
        
    }else if (indexPath.row == 4){
        UIView * cellView = [[UIView alloc] init];
        cellView.frame = CGRectMake(0, 0, ScreenWidth,  30 * px);
        [cell addSubview:cellView];
        cellView.backgroundColor = WYCGlobalBg;
        
    }else if (indexPath.row == 5){
        UIView * cellView = [[UIView alloc] init];
        cellView.frame = CGRectMake(0, 0, ScreenWidth, cell.height);
        [cell addSubview:cellView];
        
        
        UILabel * pushtitle = [[UILabel alloc] init];
        pushtitle.frame = CGRectMake(celltitleX, celltitleX, celltitleW, celltitleH);
        pushtitle.text = @"意见反馈";
        pushtitle.font = [UIFont systemFontOfSize:WyzFont];
        [cellView addSubview:pushtitle];
        
    }else if (indexPath.row == 6){
        UIView * cellView = [[UIView alloc] init];
        cellView.frame = CGRectMake(0, 0, ScreenWidth, cell.height);
        [cell addSubview:cellView];
        
        
        UILabel * pushtitle = [[UILabel alloc] init];
        pushtitle.frame = CGRectMake(celltitleX, celltitleX, celltitleW, celltitleH);
        pushtitle.text = @"清楚缓存";
        pushtitle.font = [UIFont systemFontOfSize:WyzFont];
        [cellView addSubview:pushtitle];
        
    }else {
        UIView * cellView = [[UIView alloc] init];
        cellView.frame = CGRectMake(0, 0, ScreenWidth, cell.height);
        [cell addSubview:cellView];
        
        
        UILabel * pushtitle = [[UILabel alloc] init];
        pushtitle.frame = CGRectMake(celltitleX, celltitleX, celltitleW, celltitleH);
        pushtitle.text = @"关于我们";
        pushtitle.font = [UIFont systemFontOfSize:WyzFont];
        [cellView addSubview:pushtitle];
        
    }
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row == 1) {
        WYCSetPassController * SetPass = [[WYCSetPassController alloc] init];
        [self.navigationController pushViewController:SetPass animated:NO];
    }
    if (indexPath.row == 2) {
        SetGestureLockViewController * mewallet = [[SetGestureLockViewController alloc] init];
        [self.navigationController pushViewController:mewallet animated:NO];
    }
    
    if (indexPath.row == 3) {
        WYCHideCardController * hideCard = [[WYCHideCardController alloc] init];
        [self.navigationController pushViewController:hideCard animated:NO];
    }
    
    if (indexPath.row == 5) {
        WYCOpinionController * opininon = [[WYCOpinionController alloc] init];
        [self.navigationController pushViewController:opininon animated:NO];
    }
    
   
    
    
}
@end
